<template>
	<section>
		<el-row class="app-container"> 
		<!--编辑界面 DocArchive arc_doc_archive--> 
			<el-form :model="editForm"  label-width="120px" :rules="editFormRules" ref="editForm">
				<el-form-item label="签发人" prop="signer">
					<el-input v-model="editForm.signer" placeholder="签发人"></el-input>
				</el-form-item> 
				<el-form-item label="公文编号" prop="archiveId">
					<el-input v-model="editForm.archiveId" placeholder="公文编号"></el-input>
				</el-form-item> 
				<el-form-item label="字号" prop="wordNum">
					<el-input v-model="editForm.wordNum" placeholder="字号"></el-input>
				</el-form-item> 
				<el-form-item label="成文日期" prop="writtenDate">
					<el-date-picker type="date" placeholder="选择日期" v-model="editForm.writtenDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
				</el-form-item> 
				<el-form-item label="分发日期" prop="dispatchDate">
					<el-date-picker type="date" placeholder="选择日期" v-model="editForm.dispatchDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
				</el-form-item> 
				<el-form-item label="拟稿人" prop="draftUserid">
					<el-input v-model="editForm.draftUserid" placeholder="拟稿人"></el-input>
				</el-form-item> 
				<el-form-item label="拟稿人姓名" prop="draftUsername">
					<el-input v-model="editForm.draftUsername" placeholder="拟稿人姓名"></el-input>
				</el-form-item> 
				<el-form-item label="核稿人" prop="checkUserid">
					<el-input v-model="editForm.checkUserid" placeholder="核稿人"></el-input>
				</el-form-item> 
				<el-form-item label="核稿人姓名" prop="checkUsername">
					<el-input v-model="editForm.checkUsername" placeholder="核稿人姓名"></el-input>
				</el-form-item> 
				<el-form-item label="校对人编号" prop="checkedUserid">
					<el-input v-model="editForm.checkedUserid" placeholder="校对人编号"></el-input>
				</el-form-item> 
				<el-form-item label="校队人姓名" prop="checkedUsername">
					<el-input v-model="editForm.checkedUsername" placeholder="校队人姓名"></el-input>
				</el-form-item> 
				<el-form-item label="保密级别" prop="secrecyLevel">
					<el-input v-model="editForm.secrecyLevel" placeholder="保密级别"></el-input>
				</el-form-item> 
				<el-form-item label="紧急程度" prop="urgencyLevel">
					<el-input v-model="editForm.urgencyLevel" placeholder="紧急程度"></el-input>
				</el-form-item> 
				<el-form-item label="主题词" prop="topicName">
					<el-input v-model="editForm.topicName" placeholder="主题词"></el-input>
				</el-form-item> 
				<el-form-item label="标题" prop="docTitle">
					<el-input v-model="editForm.docTitle" placeholder="标题"></el-input>
				</el-form-item> 
				<el-form-item label="流程状态" prop="docFlowState">
					<el-input v-model="editForm.docFlowState" placeholder="流程状态"></el-input>
				</el-form-item> 
				<el-form-item label="流程实例编号" prop="docProcInstId">
					<el-input v-model="editForm.docProcInstId" placeholder="流程实例编号"></el-input>
				</el-form-item> 
				<el-form-item label="文档编号" prop="docNo">
					<el-input v-model="editForm.docNo" placeholder="文档编号"></el-input>
				</el-form-item> 
				<el-form-item label="文档年月日yyyyMMdd" prop="docYmd">
					<el-input v-model="editForm.docYmd" placeholder="文档年月日yyyyMMdd"></el-input>
				</el-form-item> 
				<el-form-item label="字名" prop="wordName">
					<el-input v-model="editForm.wordName" placeholder="字名"></el-input>
				</el-form-item> 
				<el-form-item label="档案年度" prop="docYear">
					<el-input v-model="editForm.docYear" placeholder="档案年度"></el-input>
				</el-form-item> 
				<el-form-item> 
					<el-col :span="24" :offset="8"> 
						<el-button @click.native="handleCancel">取消</el-button>  
						<el-button v-loading="load.edit" type="primary" @click.native="editSubmit" :disabled="load.edit==true">提交</el-button>  
					</el-col> 
				</el-form-item> 
			</el-form>
		</el-row>
	</section>
</template>

<script>
	import util from '@/common/js/util';//全局公共库
	//
	import { editDocArchive } from '@/api/mdp/arc/doc/docArchive';
	import { mapGetters } from 'vuex'
	
	export default { 
		computed: {
		    ...mapGetters([
		      'userInfo'
		    ])
		},
		props:['docArchive','visible'],
		watch: {
	      'docArchive':function( docArchive ) {
	        this.editForm = docArchive;
	      },
	      'visible':function(visible) { 
	      	if(visible==true){
	      		//从新打开页面时某些数据需要重新加载，可以在这里添加
	      	}
	      } 
	    },
		data() {
			return {
				options:{},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]} 
				load:{ list: false, edit: false, del: false, add: false },//查询中...
				editFormRules: {
					docNo: [
						//{ required: true, message: '文档编号不能为空', trigger: 'blur' }
					]
				},
				//编辑界面数据  DocArchive arc_doc_archive
				editForm: {
					signer:'',archiveId:'',wordNum:'',writtenDate:'',dispatchDate:'',draftUserid:'',draftUsername:'',checkUserid:'',checkUsername:'',checkedUserid:'',checkedUsername:'',secrecyLevel:'',urgencyLevel:'',topicName:'',docTitle:'',docFlowState:'',docProcInstId:'',docNo:'',docYmd:'',wordName:'',docYear:''
				}
				/**begin 在下面加自定义属性,记得补上面的一个逗号**/
				
				/**end 在上面加自定义属性**/
			}//end return
		},//end data
		methods: {
			// 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听
			handleCancel:function(){
				this.$refs['editForm'].resetFields();
				this.$emit('cancel');
			},
			//编辑提交DocArchive arc_doc_archive父组件监听@submit="afterEditSubmit"
			editSubmit: function () {
				this.$refs.editForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗？', '提示', {}).then(() => { 
							this.load.edit=true
							let params = Object.assign({}, this.editForm); 
							editDocArchive(params).then((res) => {
								this.load.edit=false
								var tips=res.data.tips;
								if(tips.isOk){
									this.$refs['editForm'].resetFields();
									this.$emit('submit');//  @submit="afterEditSubmit"
								}
								this.$message({ message: tips.msg, type: tips.isOk?'success':'error' }); 
							}).catch( err =>this.load.edit=false);
						});
					}
				});
			}
			/**begin 在下面加自定义方法,记得补上面的一个逗号**/
				
			/**end 在上面加自定义方法**/
		},//end method
		components: {  
		    //在下面添加其它组件 'doc-archive-edit':DocArchiveEdit
		},
		mounted() {
			this.editForm=Object.assign(this.editForm, this.docArchive);  
		}
	}

</script>

<style scoped>

</style>